<?php
use yii\helpers\Url;
$catname = Yii::$app->params['cat_name'];
$authorname = Yii::$app->params['author_name'];
$statusname = Yii::$app->params['status_name'];

$this->title = "所有文章";
if(isset($_GET['catSlug'])){
	$this->params['breadcrumbs']['/article'] = '文章';
	$cat_name = findTextFromSlug($_GET['catSlug'],'cat_name');
	$this->params['breadcrumbs']['active'] = $cat_name;
	$this->title = $cat_name."分类下的文章";
}else{
	$this->params['breadcrumbs']['active'] = '文章';
}
$this->params['active'] = 'article';

$this->title.= ($_GET['page']>1)?" 第".$_GET['page']."页":"";
?>
<div class="am-u-md-9">
<?php if(isset($_GET['catSlug'])):
?>
<h1 id="cat-name">#<?=$cat_name?>#<small><?=$count?></small></h1>
<?php else: ?>
<div class="tagbox">
<?php foreach ($catname as $k => $v): ?>
<a class="label-item" href="<?=Url::to(['article/index','catSlug'=>$v['slug'],'page'=>1])?>"><?=$v['text']?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<ul class="blog-ul">
<?php
	if(!$data){
		echo("<li>暂没有文章！</li>");
	}else{

	foreach ($data as $value) {
		$date = explode('-',date("Y-F-d", $value['news_time']));
		$desc = explode('<!--more-->', $value['describe']);
?>
		<li >
			<div class="news-time am-monospace">
				<span class="Ftime"><?=$date[1]?></span><span class="Jtime"><?=$date[2]?></span><span class="Ytime"><?=$date[0]?></span></time>
				</div>
			<div class="news-box">
				<h3>
					<a href="<?=Url::to(['article/content','catSlug'=>$catname[$value['catid']]['slug'],'slug'=>$value['slug']])?>">
						<?=$value['title']?>
					</a>
				</h3>
				<div class="article-desc">
					<?=strip_tags($desc[0])?>
				</div>
				<div class="article-info">
					<p>
						作者:
						<?=$authorname[$value['author_id']]['text']?>&nbsp;<span class="col999">|</span>&nbsp;
						分类:
						<a href="<?=Url::to(['article/index','catSlug'=>$catname[$value['catid']]['slug'],'page'=>1])?>">
							<?=$catname[$value['catid']]['text']?>
						</a>
					</p>
				</div>
			</div>
		</li>
<?php
	}
echo '</ul>';
	echo $pageHtml;
	}
?>
</div>
<?= $this->render('/layouts/sidebar') ?>
